package com.mybase.app.UI;

import android.app.Activity;
import android.os.Bundle;
import android.os.SystemClock;
import android.widget.Button;
import android.widget.Chronometer;
import android.widget.SeekBar;
import android.widget.ToggleButton;
import com.mybase.app.R;

/**
 * Created by happy_000 on 2014/10/21.
 */
public class WidgetActivity extends Activity{
    private Chronometer cmr;
    private SeekBar seekbar;
    private ToggleButton tebtn;
    private Button btn1,btn2,btn3;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.widget_layout);
        tebtn= (ToggleButton) findViewById(R.id.widget_tebtn);
         cmr = (Chronometer) findViewById(R.id.widget_cmr);
        setCmr();

    }
    private void setCmr(){
        cmr.setBase(SystemClock.elapsedRealtime());
        cmr.start();
        cmr.setOnChronometerTickListener(new Chronometer.OnChronometerTickListener() {
            @Override
            public void onChronometerTick(Chronometer chronometer) {
                if (SystemClock.elapsedRealtime()-chronometer.getBase()>20*1000){
                    cmr.stop();
                }
            }
        });
    }


}
